<include file="public@header" />
</head>
<body>
	<div class="wrap js-check-wrap">
		<ul class="nav nav-tabs">
			<li class="active"><a href="{:url('order/index')}">订单列表</a></li>
			<li><a href="{:url('order/add')}">添加订单</a></li>
		</ul>
        <!-- <form class="well form-inline margin-top-20" method="get" action="{:url('order/index')}">
            合同编号:
            <input type="text" class="form-control" name="contract_no" style="width: 150px;" value="{:input('request.contract_no/s','')}">
            支出日期:
            <input type="text" class="form-control js-bootstrap-date" name="date" style="width: 150px;" value="{:input('request.date/s','')}" autocomplete="off">
            <input type="submit" class="btn btn-primary" value="搜索" />
            <a class="btn btn-danger" href="{:url('order/index')}">清空</a>
        </form> -->
        <br>
		<table class="table table-hover table-bordered">
			<thead>
				<tr>
					<th width="50">ID</th>
					<th>厂家名称</th>
					<th>产品信息</th>
					<th>相关项目</th>
					<th>收货信息</th>
					<th>订单报价</th>
					<th>状态</th>
					<th width="140">{:lang('ACTIONS')}</th>
				</tr>
			</thead>
			<tbody>
				<foreach name="list" item="vo">
					<tr>
						<td>{$vo.id}</td>
						<td>{$vo.manufacturer.name}</td>
						<td>{$vo.title}</td>
						<td>{$vo.project.title}|{$vo.project.project_no}</td>
						<td>{$vo.contact_name}<br>{$vo.contact_number}<br>{$vo.address}</td>
						<td>{$vo.amount|floatval}</td>
						<td>{$vo.status_text}</td>
						<td>
							<a class="btn btn-xs btn-primary" href="javascript:parent.openIframeLayer('{:url('order/payment',array('id'=>$vo['id']))}','打款记录',{area:['50%','70%']});">打款记录</a>
							<if $vo.status == 2>
                                <a class="btn btn-xs btn-primary payment" data-id="{$vo.id}">已打款</a>
                            </if>
                            <a class="btn btn-xs btn-primary" href="javascript:parent.openIframeLayer('{:url('order/send',array('id'=>$vo['id']))}','发货记录',{area:['50%','70%']});">发货记录</a>
                            <if $vo.status == 4>
                                <a class="btn btn-xs btn-primary receive" data-id="{$vo.id}">确认收货</a>
                            </if>
							<a class="btn btn-xs btn-primary" href='{:url("order/edit",array("id"=>$vo["id"]))}'>{:lang('EDIT')}</a>
							<a class="btn btn-xs btn-danger js-ajax-delete" href='{:url("order/delete",array("id"=>$vo["id"]))}'>{:lang('DELETE')}</a>
						</td>
					</tr>
				</foreach>
			</tbody>
		</table>
		<div class="pagination">{$page}</div>
	</div>
	<script src="__STATIC__/js/admin.js"></script>
    <script src="__STATIC__/layui/layui.js"></script>
    <script type="text/javascript">
        layui.use(['layer'], function(){
            var layer = layui.layer;

            $('.payment').click(function(){
                var id = $(this).data('id');
                layer.confirm('请确认！', {icon: 7, title:'提示'}, function(index){
                    $.ajax({
                        type: 'get',
                        url: '{:url("order/payment_confirm")}',
                        data: {id:id},
                        success:function(res) {
                            layer.msg(res.msg)
                            setTimeout(function(){
                                layer.close(index);
                                location.reload();
                            },1000);
                        }
                    });
                });
            });

            $('.receive').click(function(){
                var id = $(this).data('id');
                layer.confirm('请确认！', {icon: 7, title:'提示'}, function(index){
                    $.ajax({
                        type: 'get',
                        url: '{:url("order/receive_confirm")}',
                        data: {id:id},
                        success:function(res) {
                            layer.msg(res.msg)
                            setTimeout(function(){
                                layer.close(index);
                                location.reload();
                            },1000);
                        }
                    });
                });
            });

        });
    </script>
</body>
</html>